#ifndef __KEYBOARD_H
#define __KEYBOARD_H

#define KB_IRQ 0x21

#define KB_BUF_PORT 0x60

#define esc '\033'
#define backspace '\b'
#define tab '\t'
#define enter '\r'
#define delete '\177'

#define invisible 0
#define ctr_l	invisible
#define ctr_r	invisible
#define shift_l	invisible
#define shift_r	invisible
#define alt_l	invisible
#define alt_r	invisible
#define caps_lock invisible

#define shift_l_make 0x2a
#define shift_r_make 0x36
#define alt_l_make 0x38
#define alt_r_make 0xe038
#define ctl_l_make 0x1d
#define ctl_r_make 0xe01d
#define caps_lock_make 0x3a

static char keymap[][2]={
/*0x00*/	{0,	0},
/*0x01*/	{esc,	esc},
/*0x02*/	{'1',	'!'},
/*0x03*/	{'2',	'@'},
/*0x05*/	{'3',	'#'},
/*0x05*/	{'4',	'$'},
/*0x06*/	{'5',	'%'},
/*0x07*/	{'6',	'^'},
/*0x08*/	{'7',	'&'},
/*0x09*/	{'8',	'*'},
/*0x0a*/	{'9',	'('},
/*0x0b*/	{'0',	')'},
/*0x0c*/	{'-',	'_'},
/*0x0d*/	{'+',	'='},
/*0x0e*/	{backspace,backspace},
/*0x0f*/	{tab,	tab},
/*0x10*/	{'q',	'Q'},
/*0x11*/	{'w',	'W'},
/*0x12*/	{'e',	'E'},
/*0x13*/	{'r',	'R'},
/*0x14*/	{'t',	'T'},
/*0x15*/	{'y',	'Y'},
/*0x16*/	{'u',	'U'},
/*0x17*/	{'i',	'I'},
/*0x18*/	{'o',	'O'},
/*0x19*/	{'p',	'P'},
/*0x1a*/	{'[',	'{'},
/*0x1b*/	{']',	'}'},
/*0x1c*/	{enter,enter},
/*0x1d*/	{ctr_l,ctr_l},
/*0x1e*/	{'a',	'A'},
/*0x1f*/	{'s',	'S'},
/*0x20*/	{'d',	'D'},
/*0x21*/	{'f',	'F'},
/*0x22*/	{'g',	'G'},
/*0x23*/	{'h',	'H'},
/*0x24*/	{'j',	'J'},
/*0x25*/	{'k',	'K'},
/*0x26*/	{'l',	'L'},
/*0x27*/	{';',	':'},
/*0x28*/	{'\'',	'\"'},
/*0x29*/	{'`',	'~'},
/*0x2a*/	{shift_l,shift_l},
/*0x2b*/	{'\\',	'|'},
/*0x2c*/	{'z',	'Z'},
/*0x2d*/	{'x',	'X'},
/*0x2e*/	{'c',	'C'},
/*0x2f*/	{'v',	'V'},
/*0x30*/	{'b',	'B'},
/*0x31*/	{'n',	'N'},
/*0x32*/	{'m',	'M'},
/*0x33*/	{',',	'<'},
/*0x34*/	{'.',	'>'},
/*0x35*/	{'/',	'?'},
/*0x36*/	{shift_r,shift_r},
/*0x37*/	{'*',	'*'},
/*0x38*/	{alt_l, alt_l},
/*0x39*/	{' ',	' '},
/*0x3a*/	{caps_lock,caps_lock}
};
#include"global.h"
void init_keyboard(void);
int32_t keyboard_read(void *,uint32_t);
#endif
